package com.llb666.shop.order.api.vo;

import com.llb666.shop.order.domain.entity.OrderItems;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 订单商品明细.
 *
 * @author llb666
 */
@Data
public class OrderItemsVo {
    /**
     * 主键id
     */
    private String id;

    /**
     * 归属订单id
     */
    private String orderId;

    /**
     * 商品id
     */
    private String itemId;

    /**
     * 商品图片
     */
    private String itemImg;

    /**
     * 商品名称
     */
    private String itemName;

    /**
     * 规格id
     */
    private String itemSpecId;

    /**
     * 规格名称
     */
    private String itemSpecName;

    /**
     * 成交价格
     */
    private Integer price;

    /**
     * 购买数量
     */
    private Integer buyCounts;

    @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
    public interface Converter {
        OrderItemsVo.Converter INSTANCE = Mappers.getMapper(OrderItemsVo.Converter.class);

        OrderItemsVo do2Vo(OrderItems activity);

        List<OrderItemsVo> do2VoList(List<OrderItems> orderItemsList);
    }

}
